﻿
'判断评委是否已经全部签字
Option Explicit On 

Imports System
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient



Public Class ImplOAJuryOpinion
    Implements IFlowTools

    '定义全局数据库连接对象
    Private conn As SqlConnection

    '定义事务
    Private ts As SqlTransaction

    Private project As Project

    Private iocs As ImplOAContractStamp

    Private commonquery As CommonQuery
    Private weboa As webserviceOA.Service1

    Public Sub New(ByVal DbConnection As SqlConnection, ByRef trans As SqlTransaction)
        MyBase.New()
        conn = DbConnection

        '打开数据库连接
        If conn.State = ConnectionState.Closed Then
            conn.Open()
        End If

        '引用外部事务
        ts = trans

        project = New Project(conn, ts)
        weboa = New webserviceOA.Service1

        commonquery = New CommonQuery(conn, ts)

        iocs = New ImplOAContractStamp(conn, ts)

    End Sub

    Public Function UseFlowTools(ByVal workFlowID As String, ByVal projectID As String, ByVal taskID As String, ByVal finishedFlag As String, ByVal userID As String) Implements IFlowTools.UseFlowTools

        '调用webservice方法获取结果
        Dim oa As String = weboa.getPingsjg(projectID)

        '异常处理  
        If oa <> "成功" Then
            Dim pingsErr As New WorkFlowErr()
            pingsErr.ThrowNoPingsjgErr()
            Throw pingsErr
        End If

        
        If taskID = "RecordSignature" Or taskID = "RecordSignatureExp" Then
            iocs.UseFlowTools(workFlowID, projectID, taskID, finishedFlag, userID)
        End If



    End Function
End Class

